<?php namespace Phpcmf\Controllers;

class Paiming extends \Phpcmf\Home\Module
{

	public function index() {
		\Phpcmf\Service::V()->assign([
			'id' =>'',
	        'meta_title' => dr_lang('排行榜').SITE_SEOJOIN.SITE_NAME,
	        'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
	        'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
	    ]);
	    \Phpcmf\Service::V()->display('paiming-index.html');
	}
	public function quan() {
	    $list = \Phpcmf\Service::M()->table('1_quan')->order_by('tieshu', 'desc')->limit(30)->getAll();
	    $items = [];
		//$maijiadata['inputtime'] = dr_date($maijiadata['inputtime'], 'Y-m-d-H-i-s');
		foreach ($list as $i => $item) {  
		    $item['thumb'] = dr_thumb($item['thumb']); 
		    $item['jianjie'] = dr_strcut($item['description'], 18);
		    
			/*$item['uid'] = dr_member_info($item['uid']);
			$item['touid'] = dr_member_info($item['touid']);*/
			$items[$i]=$item;
		}
	    $rt=[
            'code'=>1,
            'msg'=>'',
            'data'=> $items
            ];
        $this->_json($rt['code'], $rt['msg'], $rt['data']);
	}
	public function tiezi() {
	    $list = \Phpcmf\Service::M()->table('member')->order_by('tieshu', 'desc')->limit(100)->getAll();
	    $items = [];
		//$maijiadata['inputtime'] = dr_date($maijiadata['inputtime'], 'Y-m-d-H-i-s');
		foreach ($list as $i => $item) {  
		    $item['id'] = $item['id']; 
		    $item['tieshu'] = $item['tieshu'];
		    if($item['name']){
		        $name = $item['name'];
		    } else {
		        $name = $item['username'];
		    }
		    $item['name'] = $name;
		    $item['touxiang'] = dr_avatar($item['id']);
		    $item['password'] = '';
		    $item['salt'] = '';
		    $item['zhifumima'] = '';
		    $item['zhifusalt'] = '';
		    $item['money'] = '';
		    $item['zhifusalt'] = '';
		    $item['zhifusalt'] = '';
			/*$item['uid'] = dr_member_info($item['uid']);
			$item['touid'] = dr_member_info($item['touid']);*/
			$items[$i]=$item;
		}
	    $rt=[
            'code'=>1,
            'msg'=>'',
            'data'=> $items
            ];
        $this->_json($rt['code'], $rt['msg'], $rt['data']);
	}
	public function jifen() {
	    $list = \Phpcmf\Service::M()->table('member')->order_by('score', 'desc')->limit(100)->getAll();
	    $items = [];
		//$maijiadata['inputtime'] = dr_date($maijiadata['inputtime'], 'Y-m-d-H-i-s');
		foreach ($list as $i => $item) {  
		    $item['id'] = $item['id']; 
		    $item['score'] = $item['score'];
		    if($item['name']){
		        $name = $item['name'];
		    } else {
		        $name = $item['username'];
		    }
		    $item['name'] = $name;
		    $item['touxiang'] = dr_avatar($item['id']);
		    $item['password'] = '';
		    $item['salt'] = '';
		    $item['zhifumima'] = '';
		    $item['zhifusalt'] = '';
		    $item['money'] = '';
		    $item['zhifusalt'] = '';
		    $item['zhifusalt'] = '';
			/*$item['uid'] = dr_member_info($item['uid']);
			$item['touid'] = dr_member_info($item['touid']);*/
			$items[$i]=$item;
		}
	    $rt=[
            'code'=>1,
            'msg'=>'',
            'data'=> $items
            ];
        $this->_json($rt['code'], $rt['msg'], $rt['data']);
	}

}
